<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Paho C++: src/mqtt/token.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Paho C++
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">The Paho MQTT C++ Client Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('token_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">token.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="token_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">/*******************************************************************************</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Copyright (c) 2013-2017 Frank Pagliughi &lt;fpagliughi@mindspring.com&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * All rights reserved. This program and the accompanying materials</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * are made available under the terms of the Eclipse Public License v1.0</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * and Eclipse Distribution License v1.0 which accompany this distribution.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * The Eclipse Public License is available at</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *    http://www.eclipse.org/legal/epl-v10.html</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * and the Eclipse Distribution License is available at</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> *   http://www.eclipse.org/org/documents/edl-v10.php.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * Contributors:</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> *    Frank Pagliughi - initial implementation and documentation</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> *******************************************************************************/</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#ifndef __mqtt_token_h</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define __mqtt_token_h</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &quot;MQTTAsync.h&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="iaction__listener_8h.html">mqtt/iaction_listener.h</a>&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="exception_8h.html">mqtt/exception.h</a>&quot;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="types_8h.html">mqtt/types.h</a>&quot;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="buffer__ref_8h.html">mqtt/buffer_ref.h</a>&quot;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="string__collection_8h.html">mqtt/string_collection.h</a>&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &lt;condition_variable&gt;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &lt;chrono&gt;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keyword">namespace </span>mqtt {</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">class </span>iasync_client;</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html">   49</a></span>&#160;<span class="keyword">class </span><a class="code" href="classmqtt_1_1token.html">token</a></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;{</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keyword">using</span> guard = std::lock_guard&lt;std::mutex&gt;;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keyword">using</span> unique_lock = std::unique_lock&lt;std::mutex&gt;;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keyword">mutable</span> std::mutex lock_;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    std::condition_variable cond_;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>* cli_;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    MQTTAsync_token tok_;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    const_string_collection_ptr topics_;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keywordtype">void</span>* userContext_;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>* listener_;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <span class="keywordtype">bool</span> complete_;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keywordtype">int</span> rc_;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="keywordtype">string</span> errMsg_;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#ac39954340d8b15edaa883af1bcfcf7ae">   83</a></span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classmqtt_1_1async__client.html">async_client</a>;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>token_test;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classmqtt_1_1connect__options.html">connect_options</a>;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classmqtt_1_1response__options.html">response_options</a>;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classmqtt_1_1delivery__response__options.html">delivery_response_options</a>;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classmqtt_1_1disconnect__options.html">disconnect_options</a>;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keywordtype">void</span> reset();</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordtype">void</span> set_message_id(MQTTAsync_token msgid) {</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        guard g(lock_);</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        tok_ = msgid;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    }</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> on_success(<span class="keywordtype">void</span>* tokObj, MQTTAsync_successData* rsp);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> on_failure(<span class="keywordtype">void</span>* tokObj, MQTTAsync_failureData* rsp);</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> on_connected(<span class="keywordtype">void</span>* tokObj, <span class="keywordtype">char</span>* <span class="comment">/*cause*/</span>);</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    <span class="keywordtype">void</span> on_success(MQTTAsync_successData* rsp);</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keywordtype">void</span> on_failure(MQTTAsync_failureData* rsp);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="keywordtype">void</span> check_rc() {</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        <span class="keywordflow">if</span> (rc_ != MQTTASYNC_SUCCESS)</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            <span class="keywordflow">throw</span> <a class="code" href="classmqtt_1_1exception.html">exception</a>(rc_, errMsg_);</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    }</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00153"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">  153</a></span>&#160;    <span class="keyword">using</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> = std::shared_ptr&lt;token&gt;;</div>
<div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a4e42aca59ef0e7f4c44bf3f533e95158">  155</a></span>&#160;    <span class="keyword">using</span> <a class="code" href="classmqtt_1_1token.html#a4e42aca59ef0e7f4c44bf3f533e95158">const_ptr_t</a> = std::shared_ptr&lt;const token&gt;;</div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#abfccc1dd02644f58b55671c69c85dc19">  157</a></span>&#160;    <span class="keyword">using</span> <a class="code" href="classmqtt_1_1token.html#abfccc1dd02644f58b55671c69c85dc19">weak_ptr_t</a> = std::weak_ptr&lt;token&gt;;</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli);</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, <span class="keywordtype">void</span>* userContext, <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; cb);</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; <a class="code" href="classmqtt_1_1topic.html">topic</a>);</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; <a class="code" href="classmqtt_1_1topic.html">topic</a>,</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;          <span class="keywordtype">void</span>* userContext, <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; cb);</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, const_string_collection_ptr topics);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, const_string_collection_ptr topics,</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;          <span class="keywordtype">void</span>* userContext, <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; cb);</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <a class="code" href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">token</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, MQTTAsync_token tok);</div>
<div class="line"><a name="l00216"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#abae53e34b7509096d75cc8385b04ec73">  216</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classmqtt_1_1token.html#abae53e34b7509096d75cc8385b04ec73">~token</a>() {}</div>
<div class="line"><a name="l00222"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a1fcb5574beac4792a6f55b09b1f8879a">  222</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> <a class="code" href="classmqtt_1_1token.html#a1fcb5574beac4792a6f55b09b1f8879a">create</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli) {</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;        <span class="keywordflow">return</span> std::make_shared&lt;token&gt;(cli);</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    }</div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a56cb81a58dceb3f00790b0a59b9488dc">  233</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> <a class="code" href="classmqtt_1_1token.html#a56cb81a58dceb3f00790b0a59b9488dc">create</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, <span class="keywordtype">void</span>* userContext, <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; cb) {</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;        <span class="keywordflow">return</span> std::make_shared&lt;token&gt;(cli, userContext, cb);</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    }</div>
<div class="line"><a name="l00241"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a5d9277478b2b27824633ea0e1f6fdf05">  241</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> <a class="code" href="classmqtt_1_1token.html#a5d9277478b2b27824633ea0e1f6fdf05">create</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; <a class="code" href="classmqtt_1_1topic.html">topic</a>) {</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;        <span class="keywordflow">return</span> std::make_shared&lt;token&gt;(cli, topic);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    }</div>
<div class="line"><a name="l00253"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a1de9decccf7e64439e4de8171579013a">  253</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> <a class="code" href="classmqtt_1_1token.html#a1de9decccf7e64439e4de8171579013a">create</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; <a class="code" href="classmqtt_1_1topic.html">topic</a>,</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;                        <span class="keywordtype">void</span>* userContext, <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; cb) {</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;        <span class="keywordflow">return</span> std::make_shared&lt;token&gt;(cli, topic, userContext, cb);</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;    }</div>
<div class="line"><a name="l00262"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#af13c2c1fb5da76e4ad1cd4169640592b">  262</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> <a class="code" href="classmqtt_1_1token.html#af13c2c1fb5da76e4ad1cd4169640592b">create</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, const_string_collection_ptr topics) {</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        <span class="keywordflow">return</span> std::make_shared&lt;token&gt;(cli, topics);</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;    }</div>
<div class="line"><a name="l00274"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a2e200399740bd130720d482e2d98f188">  274</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">ptr_t</a> <a class="code" href="classmqtt_1_1token.html#a2e200399740bd130720d482e2d98f188">create</a>(<a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>&amp; cli, const_string_collection_ptr topics,</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;                        <span class="keywordtype">void</span>* userContext, <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; cb) {</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keywordflow">return</span> std::make_shared&lt;token&gt;(cli, topics, userContext, cb);</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;    }</div>
<div class="line"><a name="l00282"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#aad3c92d4e1be659101e118fc11daf963">  282</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>* <a class="code" href="classmqtt_1_1token.html#aad3c92d4e1be659101e118fc11daf963">get_action_callback</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;        guard g(lock_);</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;        <span class="keywordflow">return</span> listener_;</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    }</div>
<div class="line"><a name="l00291"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#ab23933fa6d8db2501c976b79df91d1cb">  291</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classmqtt_1_1iasync__client.html">iasync_client</a>* <a class="code" href="classmqtt_1_1token.html#ab23933fa6d8db2501c976b79df91d1cb">get_client</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cli_; }</div>
<div class="line"><a name="l00296"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a5bab8b8df3d9f04e75e9c57a6c36e93c">  296</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classmqtt_1_1token.html#a5bab8b8df3d9f04e75e9c57a6c36e93c">get_message_id</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;        static_assert(<span class="keyword">sizeof</span>(tok_) &lt;= <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>), <span class="stringliteral">&quot;MQTTAsync_token must fit into int&quot;</span>);</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;        <span class="keywordflow">return</span> int(tok_);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    }</div>
<div class="line"><a name="l00306"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a9e55f1c5ab63552a7c958bfb77369f9a">  306</a></span>&#160;    <span class="keyword">virtual</span> const_string_collection_ptr <a class="code" href="classmqtt_1_1token.html#a9e55f1c5ab63552a7c958bfb77369f9a">get_topics</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;        <span class="keywordflow">return</span> topics_;</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;    }</div>
<div class="line"><a name="l00313"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a8fb4c13db17d0861b17cbe220b0696de">  313</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span>* <a class="code" href="classmqtt_1_1token.html#a8fb4c13db17d0861b17cbe220b0696de">get_user_context</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;        guard g(lock_);</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;        <span class="keywordflow">return</span> userContext_;</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    }</div>
<div class="line"><a name="l00321"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a57c8c9e1f7c404a023022eba9dbcc0c2">  321</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1token.html#a57c8c9e1f7c404a023022eba9dbcc0c2">is_complete</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> complete_; }</div>
<div class="line"><a name="l00328"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a9a8604eeeae72d211e1b20dd85ede11a">  328</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classmqtt_1_1token.html#a9a8604eeeae72d211e1b20dd85ede11a">get_return_code</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rc_; }</div>
<div class="line"><a name="l00333"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#ad916dc92354e24c17969334d84a119d6">  333</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1token.html#ad916dc92354e24c17969334d84a119d6">set_action_callback</a>(<a class="code" href="classmqtt_1_1iaction__listener.html">iaction_listener</a>&amp; listener) {</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;        guard g(lock_);</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;        listener_ = &amp;listener;</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;    }</div>
<div class="line"><a name="l00342"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a5faa55b04ee75f18df7b019bf443b1a0">  342</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1token.html#a5faa55b04ee75f18df7b019bf443b1a0">set_user_context</a>(<span class="keywordtype">void</span>* userContext) {</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        guard g(lock_);</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        userContext_ = userContext;</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    }</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1token.html#a0df41558fac781b754bebf924c332830">wait</a>();</div>
<div class="line"><a name="l00356"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#aba82e469a4fe1a08d6f0daf40d087358">  356</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1token.html#aba82e469a4fe1a08d6f0daf40d087358">try_wait</a>() {</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;        guard g(lock_);</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;        <span class="keywordflow">if</span> (complete_)</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;            check_rc();</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;        <span class="keywordflow">return</span> complete_;</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    }</div>
<div class="line"><a name="l00369"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a542cf05d67441392a5642eeb95b93df2">  369</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1token.html#a542cf05d67441392a5642eeb95b93df2">wait_for</a>(<span class="keywordtype">long</span> timeout) {</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classmqtt_1_1token.html#a542cf05d67441392a5642eeb95b93df2">wait_for</a>(std::chrono::milliseconds(timeout));</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;    }</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">class</span> Rep, <span class="keyword">class</span> Period&gt;</div>
<div class="line"><a name="l00379"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#afc834b6a55d17e401066f91a8030213f">  379</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1token.html#afc834b6a55d17e401066f91a8030213f">wait_for</a>(<span class="keyword">const</span> std::chrono::duration&lt;Rep, Period&gt;&amp; relTime) {</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;        unique_lock g(lock_);</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;        <span class="keywordflow">if</span> (!cond_.wait_for(g, std::chrono::milliseconds(relTime),</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;                            [<span class="keyword">this</span>]{<span class="keywordflow">return</span> complete_;}))</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;        check_rc();</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;    }</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">class</span> Clock, <span class="keyword">class</span> Duration&gt;</div>
<div class="line"><a name="l00394"></a><span class="lineno"><a class="line" href="classmqtt_1_1token.html#a8b1258df66e5b2aa628affd4ced47bea">  394</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1token.html#a8b1258df66e5b2aa628affd4ced47bea">wait_until</a>( <span class="keyword">const</span> std::chrono::time_point&lt;Clock, Duration&gt;&amp; absTime) {</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;        unique_lock g(lock_);</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;        <span class="keywordflow">if</span> (!cond_.wait_until(g, absTime, [<span class="keyword">this</span>]{<span class="keywordflow">return</span> complete_;}))</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        check_rc();</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;    }</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;};</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;<span class="keyword">using</span> token_ptr = token::ptr_t;</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;<span class="keyword">using</span> const_token_ptr = token::const_ptr_t;</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;<span class="comment">// end namespace mqtt</span></div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;}</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;<span class="preprocessor">#endif      // __mqtt_token_h</span></div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;<span class="preprocessor"></span></div>
<div class="ttc" id="classmqtt_1_1delivery__response__options_html"><div class="ttname"><a href="classmqtt_1_1delivery__response__options.html">mqtt::delivery_response_options</a></div><div class="ttdoc">The response options for asynchronous calls targeted at delivery. </div><div class="ttdef"><b>Definition:</b> response_options.h:68</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html"><div class="ttname"><a href="classmqtt_1_1async__client.html">mqtt::async_client</a></div><div class="ttdoc">Lightweight client for talking to an MQTT server using non-blocking methods that allow an operation t...</div><div class="ttdef"><b>Definition:</b> async_client.h:60</div></div>
<div class="ttc" id="types_8h_html"><div class="ttname"><a href="types_8h.html">types.h</a></div><div class="ttdoc">Basic types and type conversions for the Paho MQTT C++ library. </div></div>
<div class="ttc" id="classmqtt_1_1iaction__listener_html"><div class="ttname"><a href="classmqtt_1_1iaction__listener.html">mqtt::iaction_listener</a></div><div class="ttdoc">Provides a mechanism for tracking the completion of an asynchronous action. </div><div class="ttdef"><b>Definition:</b> iaction_listener.h:48</div></div>
<div class="ttc" id="classmqtt_1_1token_html_abfccc1dd02644f58b55671c69c85dc19"><div class="ttname"><a href="classmqtt_1_1token.html#abfccc1dd02644f58b55671c69c85dc19">mqtt::token::weak_ptr_t</a></div><div class="ttdeci">std::weak_ptr&lt; token &gt; weak_ptr_t</div><div class="ttdoc">Weak pointer to an object of this class. </div><div class="ttdef"><b>Definition:</b> token.h:157</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a5d9277478b2b27824633ea0e1f6fdf05"><div class="ttname"><a href="classmqtt_1_1token.html#a5d9277478b2b27824633ea0e1f6fdf05">mqtt::token::create</a></div><div class="ttdeci">static ptr_t create(iasync_client &amp;cli, const string &amp;topic)</div><div class="ttdoc">Constructs a token object. </div><div class="ttdef"><b>Definition:</b> token.h:241</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a5d479b98ffa8efdd8e85c0d647f02a15"><div class="ttname"><a href="classmqtt_1_1token.html#a5d479b98ffa8efdd8e85c0d647f02a15">mqtt::token::token</a></div><div class="ttdeci">token(iasync_client &amp;cli)</div><div class="ttdoc">Constructs a token object. </div></div>
<div class="ttc" id="string__collection_8h_html"><div class="ttname"><a href="string__collection_8h.html">string_collection.h</a></div><div class="ttdoc">Definition of the string_collection class for the Paho MQTT C++ library. </div></div>
<div class="ttc" id="classmqtt_1_1connect__options_html"><div class="ttname"><a href="classmqtt_1_1connect__options.html">mqtt::connect_options</a></div><div class="ttdoc">Holds the set of options that control how the client connects to a server. </div><div class="ttdef"><b>Definition:</b> connect_options.h:46</div></div>
<div class="ttc" id="classmqtt_1_1token_html_af13c2c1fb5da76e4ad1cd4169640592b"><div class="ttname"><a href="classmqtt_1_1token.html#af13c2c1fb5da76e4ad1cd4169640592b">mqtt::token::create</a></div><div class="ttdeci">static ptr_t create(iasync_client &amp;cli, const_string_collection_ptr topics)</div><div class="ttdoc">Constructs a token object. </div><div class="ttdef"><b>Definition:</b> token.h:262</div></div>
<div class="ttc" id="classmqtt_1_1topic_html"><div class="ttname"><a href="classmqtt_1_1topic.html">mqtt::topic</a></div><div class="ttdoc">Represents a topic destination, used for publish/subscribe messaging. </div><div class="ttdef"><b>Definition:</b> topic.h:42</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a0df41558fac781b754bebf924c332830"><div class="ttname"><a href="classmqtt_1_1token.html#a0df41558fac781b754bebf924c332830">mqtt::token::wait</a></div><div class="ttdeci">virtual void wait()</div><div class="ttdoc">Blocks the current thread until the action this token is associated with has completed. </div></div>
<div class="ttc" id="classmqtt_1_1token_html_a5faa55b04ee75f18df7b019bf443b1a0"><div class="ttname"><a href="classmqtt_1_1token.html#a5faa55b04ee75f18df7b019bf443b1a0">mqtt::token::set_user_context</a></div><div class="ttdeci">virtual void set_user_context(void *userContext)</div><div class="ttdoc">Store some context associated with an action. </div><div class="ttdef"><b>Definition:</b> token.h:342</div></div>
<div class="ttc" id="classmqtt_1_1token_html_ad916dc92354e24c17969334d84a119d6"><div class="ttname"><a href="classmqtt_1_1token.html#ad916dc92354e24c17969334d84a119d6">mqtt::token::set_action_callback</a></div><div class="ttdeci">virtual void set_action_callback(iaction_listener &amp;listener)</div><div class="ttdoc">Register a listener to be notified when an action completes. </div><div class="ttdef"><b>Definition:</b> token.h:333</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a9e55f1c5ab63552a7c958bfb77369f9a"><div class="ttname"><a href="classmqtt_1_1token.html#a9e55f1c5ab63552a7c958bfb77369f9a">mqtt::token::get_topics</a></div><div class="ttdeci">virtual const_string_collection_ptr get_topics() const </div><div class="ttdoc">Gets the topic string(s) for the action being tracked by this token. </div><div class="ttdef"><b>Definition:</b> token.h:306</div></div>
<div class="ttc" id="exception_8h_html"><div class="ttname"><a href="exception_8h.html">exception.h</a></div><div class="ttdoc">Declaration of MQTT exception class. </div></div>
<div class="ttc" id="classmqtt_1_1token_html_aad3c92d4e1be659101e118fc11daf963"><div class="ttname"><a href="classmqtt_1_1token.html#aad3c92d4e1be659101e118fc11daf963">mqtt::token::get_action_callback</a></div><div class="ttdeci">virtual iaction_listener * get_action_callback() const </div><div class="ttdoc">Gets the action listener for this token. </div><div class="ttdef"><b>Definition:</b> token.h:282</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a9a8604eeeae72d211e1b20dd85ede11a"><div class="ttname"><a href="classmqtt_1_1token.html#a9a8604eeeae72d211e1b20dd85ede11a">mqtt::token::get_return_code</a></div><div class="ttdeci">virtual int get_return_code() const </div><div class="ttdoc">Gets the return code from the action. </div><div class="ttdef"><b>Definition:</b> token.h:328</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a56cb81a58dceb3f00790b0a59b9488dc"><div class="ttname"><a href="classmqtt_1_1token.html#a56cb81a58dceb3f00790b0a59b9488dc">mqtt::token::create</a></div><div class="ttdeci">static ptr_t create(iasync_client &amp;cli, void *userContext, iaction_listener &amp;cb)</div><div class="ttdoc">Constructs a token object. </div><div class="ttdef"><b>Definition:</b> token.h:233</div></div>
<div class="ttc" id="classmqtt_1_1exception_html"><div class="ttname"><a href="classmqtt_1_1exception.html">mqtt::exception</a></div><div class="ttdoc">Base mqtt::exception. </div><div class="ttdef"><b>Definition:</b> exception.h:42</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a8b1258df66e5b2aa628affd4ced47bea"><div class="ttname"><a href="classmqtt_1_1token.html#a8b1258df66e5b2aa628affd4ced47bea">mqtt::token::wait_until</a></div><div class="ttdeci">bool wait_until(const std::chrono::time_point&lt; Clock, Duration &gt; &amp;absTime)</div><div class="ttdoc">Waits until an absolute time for the action to complete. </div><div class="ttdef"><b>Definition:</b> token.h:394</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a542cf05d67441392a5642eeb95b93df2"><div class="ttname"><a href="classmqtt_1_1token.html#a542cf05d67441392a5642eeb95b93df2">mqtt::token::wait_for</a></div><div class="ttdeci">virtual bool wait_for(long timeout)</div><div class="ttdoc">Blocks the current thread until the action this token is associated with has completed. </div><div class="ttdef"><b>Definition:</b> token.h:369</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a1fcb5574beac4792a6f55b09b1f8879a"><div class="ttname"><a href="classmqtt_1_1token.html#a1fcb5574beac4792a6f55b09b1f8879a">mqtt::token::create</a></div><div class="ttdeci">static ptr_t create(iasync_client &amp;cli)</div><div class="ttdoc">Constructs a token object. </div><div class="ttdef"><b>Definition:</b> token.h:222</div></div>
<div class="ttc" id="classmqtt_1_1iasync__client_html"><div class="ttname"><a href="classmqtt_1_1iasync__client.html">mqtt::iasync_client</a></div><div class="ttdoc">Enables an application to communicate with an MQTT server using non-blocking methods. </div><div class="ttdef"><b>Definition:</b> iasync_client.h:57</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a4e42aca59ef0e7f4c44bf3f533e95158"><div class="ttname"><a href="classmqtt_1_1token.html#a4e42aca59ef0e7f4c44bf3f533e95158">mqtt::token::const_ptr_t</a></div><div class="ttdeci">std::shared_ptr&lt; const token &gt; const_ptr_t</div><div class="ttdoc">Smart/shared pointer to an object of this class. </div><div class="ttdef"><b>Definition:</b> token.h:155</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a5bab8b8df3d9f04e75e9c57a6c36e93c"><div class="ttname"><a href="classmqtt_1_1token.html#a5bab8b8df3d9f04e75e9c57a6c36e93c">mqtt::token::get_message_id</a></div><div class="ttdeci">virtual int get_message_id() const </div><div class="ttdoc">Returns the ID of the message that is associated with the token. </div><div class="ttdef"><b>Definition:</b> token.h:296</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a57c8c9e1f7c404a023022eba9dbcc0c2"><div class="ttname"><a href="classmqtt_1_1token.html#a57c8c9e1f7c404a023022eba9dbcc0c2">mqtt::token::is_complete</a></div><div class="ttdeci">virtual bool is_complete() const </div><div class="ttdoc">Returns whether or not the action has finished. </div><div class="ttdef"><b>Definition:</b> token.h:321</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a1de9decccf7e64439e4de8171579013a"><div class="ttname"><a href="classmqtt_1_1token.html#a1de9decccf7e64439e4de8171579013a">mqtt::token::create</a></div><div class="ttdeci">static ptr_t create(iasync_client &amp;cli, const string &amp;topic, void *userContext, iaction_listener &amp;cb)</div><div class="ttdoc">Constructs a token object. </div><div class="ttdef"><b>Definition:</b> token.h:253</div></div>
<div class="ttc" id="iaction__listener_8h_html"><div class="ttname"><a href="iaction__listener_8h.html">iaction_listener.h</a></div><div class="ttdoc">Declaration of MQTT iaction_listener class. </div></div>
<div class="ttc" id="classmqtt_1_1token_html_aba82e469a4fe1a08d6f0daf40d087358"><div class="ttname"><a href="classmqtt_1_1token.html#aba82e469a4fe1a08d6f0daf40d087358">mqtt::token::try_wait</a></div><div class="ttdeci">virtual bool try_wait()</div><div class="ttdoc">Non-blocking check to see if the action has completed. </div><div class="ttdef"><b>Definition:</b> token.h:356</div></div>
<div class="ttc" id="buffer__ref_8h_html"><div class="ttname"><a href="buffer__ref_8h.html">buffer_ref.h</a></div><div class="ttdoc">Buffer reference type for the Paho MQTT C++ library. </div></div>
<div class="ttc" id="classmqtt_1_1token_html_a352686b3df96dede1b5e296de12bc427"><div class="ttname"><a href="classmqtt_1_1token.html#a352686b3df96dede1b5e296de12bc427">mqtt::token::ptr_t</a></div><div class="ttdeci">std::shared_ptr&lt; token &gt; ptr_t</div><div class="ttdoc">Smart/shared pointer to an object of this class. </div><div class="ttdef"><b>Definition:</b> token.h:153</div></div>
<div class="ttc" id="classmqtt_1_1token_html_ab23933fa6d8db2501c976b79df91d1cb"><div class="ttname"><a href="classmqtt_1_1token.html#ab23933fa6d8db2501c976b79df91d1cb">mqtt::token::get_client</a></div><div class="ttdeci">virtual iasync_client * get_client() const </div><div class="ttdoc">Returns the MQTT client that is responsible for processing the asynchronous action. </div><div class="ttdef"><b>Definition:</b> token.h:291</div></div>
<div class="ttc" id="classmqtt_1_1response__options_html"><div class="ttname"><a href="classmqtt_1_1response__options.html">mqtt::response_options</a></div><div class="ttdoc">The response options for various asynchronous calls. </div><div class="ttdef"><b>Definition:</b> response_options.h:27</div></div>
<div class="ttc" id="classmqtt_1_1token_html"><div class="ttname"><a href="classmqtt_1_1token.html">mqtt::token</a></div><div class="ttdoc">Provides a mechanism for tracking the completion of an asynchronous action. </div><div class="ttdef"><b>Definition:</b> token.h:49</div></div>
<div class="ttc" id="classmqtt_1_1token_html_abae53e34b7509096d75cc8385b04ec73"><div class="ttname"><a href="classmqtt_1_1token.html#abae53e34b7509096d75cc8385b04ec73">mqtt::token::~token</a></div><div class="ttdeci">virtual ~token()</div><div class="ttdoc">Virtual destructor. </div><div class="ttdef"><b>Definition:</b> token.h:216</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a2e200399740bd130720d482e2d98f188"><div class="ttname"><a href="classmqtt_1_1token.html#a2e200399740bd130720d482e2d98f188">mqtt::token::create</a></div><div class="ttdeci">static ptr_t create(iasync_client &amp;cli, const_string_collection_ptr topics, void *userContext, iaction_listener &amp;cb)</div><div class="ttdoc">Constructs a token object. </div><div class="ttdef"><b>Definition:</b> token.h:274</div></div>
<div class="ttc" id="classmqtt_1_1disconnect__options_html"><div class="ttname"><a href="classmqtt_1_1disconnect__options.html">mqtt::disconnect_options</a></div><div class="ttdoc">Options for disconnecting from an MQTT broker. </div><div class="ttdef"><b>Definition:</b> disconnect_options.h:37</div></div>
<div class="ttc" id="classmqtt_1_1token_html_afc834b6a55d17e401066f91a8030213f"><div class="ttname"><a href="classmqtt_1_1token.html#afc834b6a55d17e401066f91a8030213f">mqtt::token::wait_for</a></div><div class="ttdeci">bool wait_for(const std::chrono::duration&lt; Rep, Period &gt; &amp;relTime)</div><div class="ttdoc">Waits a relative amount of time for the action to complete. </div><div class="ttdef"><b>Definition:</b> token.h:379</div></div>
<div class="ttc" id="classmqtt_1_1token_html_a8fb4c13db17d0861b17cbe220b0696de"><div class="ttname"><a href="classmqtt_1_1token.html#a8fb4c13db17d0861b17cbe220b0696de">mqtt::token::get_user_context</a></div><div class="ttdeci">virtual void * get_user_context() const </div><div class="ttdoc">Retrieve the context associated with an action. </div><div class="ttdef"><b>Definition:</b> token.h:313</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_503ebd9f384f44c9859dcb1451d026bc.html">mqtt</a></li><li class="navelem"><a class="el" href="token_8h.html">token.h</a></li>
    <li class="footer">Generated on Sun Jul 23 2017 10:24:29 for Paho C++ by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
